package API.DAY11.reflect;

import java.lang.reflect.Constructor;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入学生姓名：");
        String name = scanner.nextLine();
        System.out.println("请输入学生年龄：");
        int age = scanner.nextInt();
        System.out.println("请输入学生性别：");
        char gender = scanner.next().charAt(0);
        Class cls = Class.forName("API.DAY11.reflect.Student");
        Constructor c = cls.getConstructor(String.class,int.class,char.class);
//        Object obj = c.newInstance("李四",22,'男');
        Object obj = c.newInstance(name,age,gender);
        System.out.println(obj);
    }
}
